package com.changgou.comment.util;

public final class CommentUtil {
    //匿名状态
    public static String COMMENT_ANONYMITY="1";
    //不匿名
    public static String COMMENT_NO_ANONYMITY="0";
    //评论未删除
    public static String COMMENT_DELETE="1";
    //评论已删除
    public static String COMMENT_NO_DELETE="0";
    //根据原始名字  获取匿名
    public static String anonymityMethod(String username) {
        if (username!=null){
            String first = username.substring(0, 1);
            String last = username.substring(username.length()-1);
            return first+"***"+last;
        }

        return "***";
    }

    //根据分数返回评论类型
    public static String commentTypeMethod(Double score) {
        if (score>=0.0&&score<2.0){
            return "差评";
        }else if (score>=2.0&&score<4.0){
            return "中评";
        }else {
            return "好评";
        }
    }
}
